home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d2 / sortf226.arc / SORTF.DOC < prev   
Text File  |  1988-01-09  |  7KB  |  301 lines

  1.  
  2.                   SORTF Command
  3.  
  4.         Copyright (c) Vernon D. Buerg 1985,1986,1987
  5.               Version 2.26 - December 16, 1987
  6.  
  7.  
  8. Purpose:   The SORTF command reads data from a file, sorts the
  9.        records, and writes the data to another file.
  10.  
  11. Format:
  12.        SORTF [d:][path]fname[.ext] [d:][path]fname[.ext]
  13.          [/+nnn[,len]] -or- [/-nnn,[len]]
  14.          [/Lnnn]
  15.          [/R] [/C] [/Q] [/K]
  16.  
  17. Remarks:   Records are read from the input file,  sorted,  and written
  18.        to the output file.
  19.  
  20.        Two types of records may be sorted:
  21.  
  22.        1)  logical    records.   Each  record  ends  with a carriage
  23.            return and line feed, and  may be up to 255  characters
  24.            in length.
  25.  
  26.        2)  fixed length  records.  Each record  is of length  L as
  27.            defined    by  the  '/Lnnn'  parameter.   The records may
  28.            contain any  kind of  data, including  carriage return,
  29.            line feed, and end-of-file without effecting the record
  30.            length.
  31.  
  32.  
  33.        The sort  order is  in ascending  ASCII character sequence.
  34.        You may supply the /R  parameter to reverse the sort  order
  35.        for all fields, or supply /- parameters for each key  field
  36.        to  be  sorted  in  reverse    order.     The  key  fields  are
  37.        processed from  left to  right as  supplied in  the command
  38.        line.
  39.  
  40.        The /C option may be added to cause SORTF to treat the  key
  41.        fields  as  case  insensitive  data.   That    is, lower case
  42.        letters in the key field are treated as upper case letters.
  43.  
  44.        You may  supply up  to sixteen  key offsets    and lengths by
  45.        using the /+ or /- parameter, one for each key position and
  46.        its length.     If /+    and /-    are omitted,  the key is taken
  47.        from the first character position for a length of 12.
  48.  
  49.        The position 'nnn' may be a value from one to 255.
  50.  
  51.        The key length 'len' may be  a value from 1 to 99.   The /+
  52.        operand  specifies  that  the  specified  key  is sorted in
  53.        ascending order.  The /- specifies desending sort order for
  54.        that key.
  55.  
  56.        Use the /Q option to suppress the display of  informational
  57.        messages.  Error messages can not be suppressed.
  58.  
  59.  
  60.  
  61.  
  62. SORTF Command                          Version 2.26
  63. -------------                          Dec 16, 1987
  64.  
  65.             Options Summary
  66.             ---------------
  67.  
  68.  
  69.        /C  specifies  that    the  keys  are    case  insensitive;  if
  70.            supplied, all lower case  characters in the key    fields
  71.            are  converted  to  upper  case    for  the  purposes  of
  72.            sorting.
  73.  
  74.        /R  sort in    reverse order;    over-rides any    /- options and
  75.            treats them all as /+ options.
  76.  
  77.        /Q  suppress informational messages.
  78.  
  79.        /K  creates an output file that consists of sorted key data
  80.            only.
  81.  
  82.        /L  specifies the sorting of fixed length records
  83.  
  84.        /+  defines the location  and length of  a key field  to be
  85.            sorted in ascending order
  86.  
  87.        /-  defines the location  and length of  a key field  to be
  88.            sorted in descending order
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. SORTF Command                          Version 2.26
  123. -------------                          Dec 16, 1987
  124.  
  125.             Examples
  126.             --------
  127.  
  128.        o  to  sort    a  file  in  descending order with the keys in
  129.           position 10:
  130.  
  131.         SORTF TEST.DAT TEST.SRT /R/+10
  132.  
  133.  
  134.        o to sort the same file using keys with 24 characters:
  135.  
  136.         SORTF TEST.DAT TEST.SRT /R/+10,24
  137.  
  138.        o to sort a file of fixed length, binary records; the input
  139.          file contains records of 18 bytes each,  the  key is  two
  140.          bytes  at    position  17  in  each    record    in  descending
  141.          order, and 12 bytes at postion 1 in ascending order:
  142.  
  143.         SORTF SRTCATS.RND SRTCATS.IND /L18 /-17,2 /+1,12
  144.  
  145.  
  146.        o to sort on different keys, but creating an an output file
  147.          with the keys only:
  148.  
  149.         SORTF TEST.DAT TEST.KEYS /-10,2 /+20,4 /-16,3 /K
  150.  
  151.        Note the use of /-.    It specifies that the first and  third
  152.        keys  are  sorted  in  descending  order, the second key is
  153.        sorted in ascending order.
  154.  
  155.        The format of the keys-only file is:
  156.  
  157.        Offset  Length   Contents
  158.        ------  ------   ------------------------------------------
  159.          0         1        Length of data record excluding CR and LF
  160.          1         3        Offset to record in input file
  161.                  +0  hi-byte of 3-byte address offset
  162.                  +1  low word of address offset
  163.          4         n        Variable key data, depends on key definitions
  164.  
  165.        In the example above, the variable key data format is:
  166.  
  167.          4         2        Data in records at offset 10
  168.          6         4        Data in records at offset 20
  169.         10         3        Data in records at offset 16
  170.         13         0        End of key record.
  171.  
  172.  
  173.  
  174.        The length of  each keys-only record  is 4 plus  the sum of
  175.        the individual key lengths.    The default, if no /+ or /- is
  176.        specified, is 16 bytes each.
  177.  
  178.  
  179.  
  180.  
  181.  
  182. SORTF Command                          Version 2.26
  183. -------------                          Dec 16, 1987
  184.  
  185.             Version History
  186.             ---------------
  187.  
  188.     2.0, July 11, 1985.
  189.        o  Corrects CR/LF problem. Remember, it is assumed that
  190.           all "records" end in a carriage return (CR). Those
  191.           that do not may appear as part of other records to
  192.           a text editor.
  193.  
  194.     2.1, August 3, 1985
  195.        o  Corrects a problem sorting files larger than 64K.
  196.  
  197.     2.15, December 27, 1985
  198.        o  Corrects problems with first record of file.
  199.        o  Adds /C option to treat keys as case insensitive data
  200.        o  The key length may be specified on the command line
  201.  
  202.     2.17, February 25, 1987
  203.        o  Correct problem when maximum records exceeded
  204.        o  Convert to COM program
  205.  
  206.     2.20, June 28, 1987
  207.        o  Add /Q option to suppress informational messages
  208.        o  Change to allow up to 16 key field specifications
  209.  
  210.     2.23, August 6, 1987
  211.        o  Add "-" option to sort individual fields in reverse order
  212.        o  Add /K option to produce output file with keys only
  213.  
  214.     2.24, September 15, 1987
  215.        o  Add /Lnnn option for sorting fixed length records
  216.  
  217.     2.25, September 19, 1987
  218.        o  Correction for /L dropping last char of file and fouling
  219.           records.
  220.  
  221.     2.26, December 16, 1987
  222.        o  Cosmetic changes
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242. SORTF Command                          Version 2.26
  243. -------------                          Dec 16, 1987
  244.  
  245.             Restrictions
  246.             ------------
  247.  
  248.        Depending on the amount of  memory available,  up to  40000
  249.        records, or a file up to 16-Mb, may be sorted.
  250.  
  251.        The advantages of using  SORTF  instead of the SORT filter:
  252.         - files larger than 63K may be sorted
  253.         - less time is required
  254.         - sort order can be based on up to 16 fields
  255.         - fixed length files can be sorted
  256.  
  257.        For    best  results,    place the  input file  on the  fastest
  258.        available drive, e.g. RAM disk.
  259.  
  260.  
  261.  
  262.        Written by  Vernon Buerg  for the  IBM PC  using DOS 2.0 or
  263.        later.  You may distribute SORTF given these restrictions:
  264.  
  265.        o the program shall be supplied in its original, unmodified
  266.          form, which includes this documentation;
  267.  
  268.        o no fee is charged;
  269.  
  270.        o for-profit use without a license is prohibited;
  271.  
  272.        o the program may not  be included, or bundled, with  other
  273.          goods  or    services.   Exceptions    may  be  granted  upon
  274.          written  request  only.    This  applies  to   clubs  and
  275.          distributors.
  276.  
  277.        For use by corporations and other institutions, contact  me
  278.        for a licensing agreement.
  279.  
  280.         Vernon D. Buerg
  281.         456 Lakeshire Drive
  282.         Daly City, CA 94015
  283.  
  284.         Data: (415) 994-2944, VOR 24-hour BBS
  285.         CompuServe: 70007,1212
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.